<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OrangeCNC - ARISC firmware documentation: mod_timer.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">OrangeCNC - ARISC firmware documentation
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('mod__timer_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">mod_timer.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="mod__timer_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#ifndef _MOD_TIMER_H</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#define _MOD_TIMER_H</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;or1k-sprs.h&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;or1k-support.h&gt;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="sys_8h.html">sys.h</a>&quot;</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">// public macros</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="mod__timer_8h.html#a150e4f9c8426a49d5153393b6612ef9e">   25</a></span>&#160;<span class="preprocessor">#define TIMER_FREQUENCY         CPU_FREQ</span></div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="mod__timer_8h.html#a19f140dc1376350673aaac7d35cf1ccf">   26</a></span>&#160;<span class="preprocessor">#define TIMER_FREQUENCY_MHZ     (CPU_FREQ/1000000)</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment">// public methods as macros</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="mod__timer_8h.html#a61d5531e2b8556916fa42733208f0659">   34</a></span>&#160;<span class="preprocessor">#define TIMER_START() \</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">    or1k_mtspr(OR1K_SPR_TICK_TTMR_ADDR, OR1K_SPR_TICK_TTMR_MODE_SET(0, OR1K_SPR_TICK_TTMR_MODE_CONTINUE))</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="mod__timer_8h.html#a8055a02ef3688352212e0dba357905b3">   38</a></span>&#160;<span class="preprocessor">#define TIMER_STOP() \</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">    or1k_mtspr(OR1K_SPR_TICK_TTMR_ADDR, 0)</span></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="mod__timer_8h.html#a6cb2b7772151124948e5d17d1c6e08ea">   42</a></span>&#160;<span class="preprocessor">#define TIMER_CNT_SET(CNT) \</span></div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="preprocessor">    or1k_mtspr(OR1K_SPR_TICK_TTCR_ADDR, CNT)</span></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="mod__timer_8h.html#a8e6a3b2eb0563b3d94d83939efce5b21">   46</a></span>&#160;<span class="preprocessor">#define TIMER_CNT_GET() \</span></div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="preprocessor">    or1k_mfspr(OR1K_SPR_TICK_TTCR_ADDR)</span></div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="comment">// export public methods</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="keywordtype">void</span> <a class="code" href="mod__timer_8h.html#a161432848a326da3a1ea7765fc2bc023">timer_start</a>();</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="keywordtype">void</span> <a class="code" href="mod__timer_8h.html#aa04078f48a0e8f5b6860a393ad06b535">timer_stop</a>();</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="keywordtype">void</span> <a class="code" href="mod__timer_8h.html#aef86d8f8e96209074113a6579ba042ce">timer_cnt_set</a>(uint32_t cnt);</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;uint32_t <a class="code" href="mod__timer_8h.html#ac0b22a5df951fddf6977edf3b1cd55f6">timer_cnt_get</a>();</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;uint64_t <a class="code" href="mod__timer_8h.html#a197b3a4ed7085bc37f8dcb177c80486f">timer_cnt_get_64</a>();</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="sys_8h_html"><div class="ttname"><a href="sys_8h.html">sys.h</a></div></div>
<div class="ttc" id="mod__timer_8h_html_aa04078f48a0e8f5b6860a393ad06b535"><div class="ttname"><a href="mod__timer_8h.html#aa04078f48a0e8f5b6860a393ad06b535">timer_stop</a></div><div class="ttdeci">void timer_stop()</div><div class="ttdoc">stop system timer </div><div class="ttdef"><b>Definition:</b> mod_timer.c:45</div></div>
<div class="ttc" id="mod__timer_8h_html_a197b3a4ed7085bc37f8dcb177c80486f"><div class="ttname"><a href="mod__timer_8h.html#a197b3a4ed7085bc37f8dcb177c80486f">timer_cnt_get_64</a></div><div class="ttdeci">uint64_t timer_cnt_get_64()</div><div class="ttdoc">get system timer counter total value </div><div class="ttdef"><b>Definition:</b> mod_timer.c:76</div></div>
<div class="ttc" id="mod__timer_8h_html_aef86d8f8e96209074113a6579ba042ce"><div class="ttname"><a href="mod__timer_8h.html#aef86d8f8e96209074113a6579ba042ce">timer_cnt_set</a></div><div class="ttdeci">void timer_cnt_set(uint32_t cnt)</div><div class="ttdoc">set system timer counter value </div><div class="ttdef"><b>Definition:</b> mod_timer.c:56</div></div>
<div class="ttc" id="mod__timer_8h_html_ac0b22a5df951fddf6977edf3b1cd55f6"><div class="ttname"><a href="mod__timer_8h.html#ac0b22a5df951fddf6977edf3b1cd55f6">timer_cnt_get</a></div><div class="ttdeci">uint32_t timer_cnt_get()</div><div class="ttdoc">get system timer counter value </div><div class="ttdef"><b>Definition:</b> mod_timer.c:66</div></div>
<div class="ttc" id="mod__timer_8h_html_a161432848a326da3a1ea7765fc2bc023"><div class="ttname"><a href="mod__timer_8h.html#a161432848a326da3a1ea7765fc2bc023">timer_start</a></div><div class="ttdeci">void timer_start()</div><div class="ttdoc">start system timer in continues mode </div><div class="ttdef"><b>Definition:</b> mod_timer.c:34</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="mod__timer_8h.html">mod_timer.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
